<?php
        include "KoneksiDB.php";
        $error = '';
        $name = $_POST['makalah'];
        $query = "SELECT * FROM upload WHERE name Like '$name'or username like '%$name'";
        $hasil = mysql_query($query);
        $data = mysql_fetch_array($hasil);
        ////get the nama value from form
        if (empty($name)) {
              echo "<center>";
            echo "<h2> Hasil Searching </h2>";
            echo "tidak dapat mencari kata yang dimasukan";
        }
        else
            {
            $sql = mysql_query("SELECT * FROM upload WHERE name LIKE '$name' or username like '$name' ") or die(mysql_error());

            $result = mysql_num_rows($sql);  //execute the query $q


            echo "<center>";
            echo "<h2> Hasil Searching </h2>";
            while ($data = mysql_fetch_array($sql)) {
//
                echo "<li><a href='download.php?id=" . $data['id'] . "'>" . $data['name'] . "</a> ";
                echo " peneliti :" . $data['username'];
                echo "</ul>";
            }
        }

//$name = $_POST['name']; //get the nama value from form
//$q = "SELECT * from upload where name like '%$name%'or username like '%$name%'"; //query to get the search result
//$result = mysql_query($q); //execute the query $q
//
//echo "<center>";
//echo "<h2> Hasil Searching </h2>";
//
//
//while ($data = mysql_fetch_array($result)) {
//
//                    echo "<li><a href='download.php?id=" . $data['id'] . "'>" . $data['name'] . "</a> ";
//
//                echo "</ul>";}
//                else{
//                    echo 'data ga ada';
//                }
//while ($data = mysql_fetch_array($result)) {  //fetch the result from query into an array
//    echo "
//<tr>
//
//<td>" . $data['name'] . "</td>
//
//</tr>";
//}
//echo "</table>";
        ?><!-- Akhir dari div menu -->
